package field

import "gitee.com/yanwc/net/utils"

// field 动态计算 U1 km/h
type (
	Speed    uint8 // km/h 
	SpeedRaw [1]byte
)

func (s Speed) Raw() (out SpeedRaw) {
	copy(out[:], utils.NumberToBytesWithBigEndian(s))
	return
}

func (s SpeedRaw) Type() Speed {
	return utils.BytesToNumber[Speed](s[:])
}

func (s SpeedRaw) Slice() []byte {
	return s[:]
}
